/**
 * Created by 春旺 on 2017/3/22.
 */
//*****************************************************************************
// Multipies.java           Java Foundations
//  Demonstrates use of a for loop
//*******************************************************************************
import java.util.Scanner;
public class Multipies
{
    //---------------------------------------------------------------------------
    //  Prints multiples of a user-specified number up to a user-
    // specified limit.
    //----------------------------------------------------------------------------
    public static void main(String[] args)
    {
        final int PER_LINE = 5;
        int value, limit, mult, count = 0;

        Scanner scan = new Scanner(System.in);

        System.out.println("Enter a positive value: ");
        value = scan.nextInt();

        System.out.println("Enter a positive limit: ");
         limit = scan.nextInt();

        System.out.println();
        System.out.println("The multiples of " + value + "between" +
                             value + "and" + limit + "(inclusive) are:");

        for (mult = value;mult <= limit; mult += value)
        {
            System.out.print(mult + "\t");

            // Print a specific number of value per line of output
            count ++;
            if (count % PER_LINE == 0)// 防止一行输出过多的数字。（括号后面有分号就不会执行下一条语句。）
               System.out.println();
        }
    }
}
